import request from '@/utils/request'

// api地址
const api = {
  data: '/store/data',
  tenants: '/store/users/tenants',
  scan: '/store/users/scan-code',
  universals: '/web/setting/tenants/universals/detail'
}

// 获取商城基础信息(废弃)
export const data = () => {
  return request.get(api.data)
}

// 获取商户
export const getTenantsList = () => {
  return request.get(api.tenants, {}, { load: false })
}

// 获取门店
export const getShopsList = (tenantId) => {
  return request.get(`/store/users/${tenantId}/shops?includeMaster=1`, {}, { load: false })
}

// 获取店铺
export const getStoresList = (shopId) => {
  return request.get(`/store/users/${shopId}/stores`, {}, { load: false })
}

// 获取自提点列表
export const getPickupList = (shopId) => {
  return request.get(`/store/shops/${shopId}/pickups`, {}, { load: false })
}

// 切换门店
export const changeShops = (tenantId, shopId) => {
  return request.post(`/store/users/tenants/${tenantId}/shops/${shopId}/change`)
}

// 用户扫一扫
export const scanCode = (param, option) => {
  return request.get(api.scan, param, option)
}

// 获取商户配置项
export const getTenantsUniversals = (param, option) => {
  return request.get(api.universals, param, option)
}
